package last.multicode.fund;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String text = scanner.next();
        String[] array = text.split(";");
        int n = Integer.parseInt(array[0]);
        int num = Integer.parseInt(array[1]);
        double a = Double.parseDouble(array[2]);
        OneFund oneFund = new OneFund(n, num, a);

        text = scanner.next();
        array = text.split(";");
        n = Integer.parseInt(array[0]);
        num = Integer.parseInt(array[1]);
        a = Double.parseDouble(array[2]);
        double b = Double.parseDouble(array[3]);
        TwoFund twoFund = new TwoFund(n, num, a, b);

        System.out.println(oneFund.income());
        System.out.println(twoFund.income());
    }
}
